package day3;

import java.util.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class MapTest {
    public static void main(String[] args) {
        Map<String,String> map=new HashMap<>();
        map.put("dog","狗");
        map.put("snake","蛇");
        map.put("python","蟒蛇");
        map.put("tiger","老虎");
        map.put("dog","小狗");
        map.put("none",null);
        System.out.println(map.size());
        System.out.println(map);
        String dog = map.get("dog");
        System.out.println(dog);
        String tiger = map.remove("tiger");
        System.out.println(tiger+"被删除乐");
        System.out.println(">>>>>>>>>>>>>>>>>>>");
        System.out.println(map);
        //contains是
        Scanner in=new Scanner(System.in);
        System.out.println("输入洋文找中文：");
        String key=in.next();
//        String value=map.get(key);
        //>>> map.containsValue()
        if(map.containsKey(key)){
            String value=map.get(key);
            System.out.println(key+"对应的中文是："+value);
        }else{
            System.out.println(key+"不存在");
        }
//        if(value==null){//不完整
//            System.out.println(key+"不存在");
//        }else{
//            System.out.println(key+"对应的英文是："+value);
//        }
    }
}
